package cn.tedu.review;

/**
 * @author ：Dsi
 * @date ：2021/11/22 9:16
 * Describe ：该类用于复习多线程编程实现方案一：采用继承Threa方式
 */
public class TestThread {
    public static void main(String[] args) {
        Ticket t1 = new Ticket();
        Ticket t2 = new Ticket();
        Ticket t3 = new Ticket();
        Ticket t4 = new Ticket();
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}

class Ticket extends Thread {
    static int ticket = 100;

    @Override
    public void run() {
        while (true) {
            System.out.println(getName() + "=" + ticket--);
            if (ticket <= 0) break;
        }
    }
}